package com.xianyun.site.iblog.user.executor.handle.impl;

import com.xianyun.site.iblog.convertor.SystemUserConvertor;
import com.xianyun.site.iblog.dto.user.SystemUserLoginQry;
import com.xianyun.site.iblog.dto.user.data.SystemUserDTO;
import com.xianyun.site.iblog.gatewayimpl.database.SystemUserMapper;
import com.xianyun.site.iblog.gatewayimpl.database.domainobject.SystemUserDO;
import com.xianyun.site.iblog.user.executor.handle.BaseLoginCheckHandle;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**
 * @author mac_zyj
 */
@Slf4j
@Component
public class AuthResultCheckHandle extends BaseLoginCheckHandle {

    @Autowired
    private SystemUserMapper systemUserMapper;


    @Override
    public SystemUserDTO loginExecute(SystemUserLoginQry qry) {
        SystemUserDO searchData = systemUserMapper.getSystemUserByUuidAndSource(qry.getSocialId(), qry.getSource());
        if (null != searchData){
            return SystemUserConvertor.toSystemUserDTO(searchData);
        }
        return new SystemUserDTO();
    }
}
